class Car {
  constructor(model) {
    this.model = model;
  }
}

class CarFactory {
  static create(model) {
    switch(model) {
      case 'Sedan':
        return new Car('Sedan');
      case 'SUV':
        return new Car('SUV');
      default:
        throw new Error('Unknown car model');
    }
  }
}

const sedan = CarFactory.create('Sedan');
const suv = CarFactory.create('SUV');
console.log(sedan.model); // 输出：Sedan
console.log(suv.model); // 输出：SUV
